<!--
 * @Author: zhang gen yuan
 * @Date: 2021-06-02 10:18:09
 * @Descripttion: 
-->
<template>
  <div class="login">
    <el-input v-model="uname"></el-input>
    <el-input v-model="upwd" type="password"></el-input>
    <el-button type="primary" @click="loginHandle" size="medium" class="btn">登录</el-button>
  </div>
</template>

<script setup>
import { ref } from "vue";
import { useStore } from "vuex";
import { useRouter } from "vue-router";
let uname = ref("admin");
let upwd = ref("123456");
let store = useStore();
let router = useRouter();
function loginHandle() {
  if (uname.value == "admin" && upwd.value == "123456") {
    store.commit("user/setToken", "这是token");
    router.push({
      path: "/home",
    });
  }
}
</script>

<style lang="scss" scoped>
.login{
  width: 500px;
  height: 200px;
  margin: 100px auto;
  .btn{
    width: 100%;
    margin-top: 15px;
  }
}
</style>